#ifndef __MODBUS_APP_H__
#define __MODBUS_APP_H__

#include "common.h"

/* Modbus register mappings */
#define MODBUS_REG_START 0

/* Input registers (read-only) */
#define REG_INPUT_STATUS_BASE      0
#define REG_ANALOG_INPUT_BASE      100
#define REG_TEMPERATURE_BASE       200
#define REG_FLOW_BASE              300
#define REG_WATER_QUALITY_BASE     400
#define REG_PID_OUTPUT_BASE        500

/* Holding registers (read-write) */
#define REG_CONTROL_BASE           0
#define REG_SETPOINT_BASE          100
#define REG_PID_PARAM_BASE         200
#define REG_ALARM_LIMITS_BASE      300
#define REG_SYSTEM_CONFIG_BASE     400

/* Function declarations */
rt_err_t modbus_app_init(void);
void modbus_app_thread_entry(void *parameter);
rt_err_t modbus_update_input_registers(void);
rt_err_t modbus_process_holding_register(uint16_t address, uint16_t value);

#endif /* __MODBUS_APP_H__ */